﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace PayService
{
    public class Tool
    {
        /// <summary>
        /// 取状态
        /// </summary>
        /// <returns></returns>
        public static bool GetStatus(string name)
        {
            //String[] list = File.ReadAllLines(configUrl);
            //return Convert.ToInt32(list[count].Split('=')[1]) == 0 ? false : true;
            //将XML文件加载进来
            return GetXmlValueByName(name) == "on" ? true : false;
        }
        public static string GetXmlValueByName(string name)
        {
            //将XML文件加载进来
            XDocument document = XDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "/Config/Config.xml");
            //获取到XML的根元素进行操作
            XElement root = document.Root;
            XElement eleCookie = root.Element(name);
            //获取name标签的值
            return eleCookie.Value;
        }
    }
}
